package com.rd.student.jiaji.class2.duyukun.Day0731;

import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入要随机的次数：");
        int n = scanner.nextInt();


        int[] indexArr = new int[20];
        for (int i = 0; i < n; i++) {
            int index = (int) (Math.random() * 50);
            boolean flag = false;
            for (int j = 0; j < i; j++) {
                if (index == indexArr[j]) {
                    flag = true;
                    break;

                }
            }
            if (!flag) {
                indexArr[i] = index;
            }
            if (flag) {
                i--;
                continue;
            }
            System.out.print(indexArr[i] + " ");

        }

    }
}
